﻿@model IEnumerable<YogaStudio.WebUI.Models.SectionViewModel>
@if (User.IsInRole("Admin"))
{
<p>
        @Html.ActionLink("Create New", "Create", null, new { @class = "btn" })
</p>
}
<div class="datagrid">
    <table class="box-table-a">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.CourseName)
            </th>
            @if (User.IsInRole("Admin"))
            {
            <th>
                @Html.DisplayNameFor(model => model.FacultyName)
            </th>
            }
            <th>
                @Html.DisplayNameFor(model => model.SemesterName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Year)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.FromDate)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ToDate)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Price)
            </th>
            <th>
                Students / @Html.DisplayNameFor(model => model.Capacity)
            </th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.CourseName)
                </td>
                @if (User.IsInRole("Admin"))
                {
                <td>
                    @Html.DisplayFor(modelItem => item.FacultyName)
                </td>
                }
                <td>
                    @Html.DisplayFor(modelItem => item.SemesterName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Year)
                </td>
                <td>
                    @item.FromDate.Value.ToShortDateString()
                </td>
                <td>
                    @item.ToDate.Value.ToShortDateString()
                </td>
                <td>
                    $@Html.DisplayFor(modelItem => item.Price)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Volume)/
                    @Html.DisplayFor(modelItem => item.Capacity)
                </td>
            </tr>
        }

    </table>
</div>
